// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const api = {
  /**
    * 获取主列表
    */
  queryByPlanType (params) {
    return Service.get(
      `/${ServiceName}/api/external/TYardTicketController/queryByPlanType`,{params}
    )
  },
  /**
    * 获取票货信息 计划id
    */
  queryTYardTicket (params) {
    return Service.post(
      `/${ServiceName}/api/external/TYardTicketController/queryTYardTicket`,params
    )
  },
  /**
    * 根据库场id获取区域 storehouseId
    */
  listRegionByStorehouseId (params) {
    return Service.get(
      `/${ServiceName}/api/external/TYardTicketController/listRegionByStorehouseId?storehouseId=${params}`
    )
  },
  /**
    * 新增作业票
    */
  addTYardTicket (params) {
    return Service.post(
      `/${ServiceName}/api/external/TYardTicketController/addTYardTicket`, params
    )
  },
  /**
    * 修改作业票
    */
  updateTYardTicket (params) {
    return Service.put(
      `/${ServiceName}/api/external/TYardTicketController/updateTYardTicket`, params
    )
  },
  /**
    * 回显作业票
    */
  queryById (params) {
    return Service.post(
      `/${ServiceName}/api/external/TYardTicketController/queryById`, params
    )
  },
  /**
    * 删除作业票
    */
  deleteById (params) {
    return Service.delete(
      `/${ServiceName}/api/external/TYardTicketController/deleteById`, {params}
    )
  },
  /**
    * 审核/销审作业票
    */
  updateStatus (params) {
    return Service.get(
      `/${ServiceName}/api/external/TYardTicketController/updateStatus`, {params}
    )
  },
  /**
    * 获取过磅数据
    */
  selectYardTally (params) {
    return Service.post(
      `/${ServiceName}/api/external/TYardTicketController/selectYardTally`, params
    )
  },
  /**
    * 查询理货数据
    */
  selectTYardTicket (params) {
    return Service.get(
      `/${ServiceName}/api/external/TYardTicketController/selectTYardTicket`, {params}
    )
  },
  /**
    * 根据计划查子过程
    */
  selectProcess (params) {
    return Service.get(
      `/${ServiceName}/api/external/TYardTicketController/selectProcess?processCode=${params}` 
    )
  },
  /**
    * 查询机械种类
    */
  selectEquipmentTypeName (params) {
    return Service.get(
      `/${ServiceName}/api/external/TYardTicketController/selectEquipmentTypeName?id=${params}`
    )
  },
  /**
    * 查询机械
    */
  selectEquipment (params) {
    return Service.get(
      `/${ServiceName}/api/external/TYardTicketController/selectEquipment`, { params }
    )
  },
  /**
    * 查询理货数据
    */
  selectYardTallyByEquipmentNo (params) {
    return Service.post(
      `/${ServiceName}/api/external/TYardTicketController/selectYardTallyByEquipmentNo`, params
    )
  },
  /**
    * 新增作业量
    */
  addTYardTicketShare (params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/TYardTicketController/addTYardTicketShare`, params
    )
  },
  /**
    * 查询劳务
    */
   selectWorker (params) {
    return Service.get(
      `/${ServiceName}/api/external/TYardTicketController/selectWorker`, { params }
    )
  },
  /**
    * 查询总件数重量体积车数
    */
   selectYardTallyTotal (params) {
    return Service.post(
      `/${ServiceName}/api/external/TYardTicketController/selectYardTallyTotal`, params
    )
  },
  /**
    * 回显总件数重量体积车数
    */
   selectTYardTicketNumByTicket (params) {
    return Service.post(
      `/${ServiceName}/api/external/TYardTicketController/selectTYardTicketNumByTicket`, params
    )
  },
}
export default api